home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Source / GNU / make / make-3.74 / make.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  9.0 KB  |  372 lines

  1. /* Miscellaneous global declarations and portability cruft for GNU Make.
  2. Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
  3. This file is part of GNU Make.
  4.  
  5. GNU Make is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. GNU Make is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with GNU Make; see the file COPYING.  If not, write to
  17. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* AIX requires this to be the first thing in the file.  */
  20. #if defined (_AIX) && !defined (__GNUC__)
  21.  #pragma alloca
  22. #endif
  23.  
  24. /* We use <config.h> instead of "config.h" so that a compilation
  25.    using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
  26.    (which it would do because make.h was found in $srcdir).  */
  27. #include <config.h>
  28. #undef    HAVE_CONFIG_H
  29. #define HAVE_CONFIG_H
  30.  
  31. #ifdef    CRAY
  32. /* This must happen before #include <signal.h> so
  33.    that the declaration therein is changed.  */
  34. #define    signal    bsdsignal
  35. #endif
  36.  
  37. #define _GNU_SOURCE
  38. #include <sys/types.h>
  39. #include <sys/stat.h>
  40. #include <signal.h>
  41. #include <stdio.h>
  42. #include <ctype.h>
  43. #ifdef HAVE_SYS_TIMEB_H
  44. /* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs
  45.    unless <sys/timeb.h> has been included first.  Does every system have a
  46.    <sys/timeb.h>?  If any does not, configure should check for it.  */
  47. #include <sys/timeb.h>
  48. #endif
  49. #include <time.h>
  50. #include <errno.h>
  51.  
  52. #ifndef    errno
  53. extern int errno;
  54. #endif
  55.  
  56. #ifndef    isblank
  57. #define    isblank(c)    ((c) == ' ' || (c) == '\t')
  58. #endif
  59.  
  60. #ifdef    HAVE_UNISTD_H
  61. #include <unistd.h>
  62. /* Ultrix's unistd.h always defines _POSIX_VERSION, but you only get
  63.    POSIX.1 behavior with `cc -YPOSIX', which predefines POSIX itself!  */
  64. #if defined (_POSIX_VERSION) && !defined (ultrix)
  65. #define    POSIX
  66. #endif
  67. #endif
  68.  
  69. /* Some systems define _POSIX_VERSION but are not really POSIX.1.  */
  70. #if (defined (butterfly) || defined (__arm) || \
  71.      (defined (__mips) && defined (_SYSTYPE_SVR3)) || \
  72.      (defined (sequent) && defined (i386)))
  73. #undef POSIX
  74. #endif
  75.  
  76. #if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
  77. #define POSIX
  78. #endif
  79.  
  80. #if !defined (HAVE_SYS_SIGLIST) && defined (HAVE__SYS_SIGLIST)
  81. #define    sys_siglist    _sys_siglist
  82. #define    HAVE_SYS_SIGLIST    /* Now we have it.  */
  83.  
  84. /* It was declared in <signal.h>, with who knows what type.
  85.    Don't declare it again and risk conflicting.  */
  86. #define    SYS_SIGLIST_DECLARED
  87. #endif
  88.  
  89. #ifdef HAVE_SYS_SIGLIST
  90. #ifndef SYS_SIGLIST_DECLARED
  91. extern char *sys_siglist[];
  92. #endif
  93. #else
  94. #include "signame.h"
  95. #endif
  96.  
  97. /* Some systems do not define NSIG in <signal.h>.  */
  98. #ifndef    NSIG
  99. #ifdef    _NSIG
  100. #define    NSIG    _NSIG
  101. #else
  102. #define    NSIG    32
  103. #endif
  104. #endif
  105.  
  106. #ifndef    RETSIGTYPE
  107. #define    RETSIGTYPE    void
  108. #endif
  109.  
  110. #ifndef    sigmask
  111. #define    sigmask(sig)    (1 << ((sig) - 1))
  112. #endif
  113.  
  114. #ifdef    HAVE_LIMITS_H
  115. #include <limits.h>
  116. #endif
  117. #ifdef    HAVE_SYS_PARAM_H
  118. #include <sys/param.h>
  119. #endif
  120.  
  121. #ifndef    PATH_MAX
  122. #ifndef    POSIX
  123. #define    PATH_MAX    MAXPATHLEN
  124. #endif    /* Not POSIX.  */
  125. #endif    /* No PATH_MAX.  */
  126. #ifndef MAXPATHLEN
  127. #define MAXPATHLEN 1024
  128. #endif    /* No MAXPATHLEN.  */
  129.  
  130. #ifdef    PATH_MAX
  131. #define    GET_PATH_MAX    PATH_MAX
  132. #define    PATH_VAR(var)    char var[PATH_MAX]
  133. #else
  134. #define    NEED_GET_PATH_MAX
  135. extern unsigned int get_path_max ();
  136. #define    GET_PATH_MAX    (get_path_max ())
  137. #define    PATH_VAR(var)    char *var = (char *) alloca (GET_PATH_MAX)
  138. #endif
  139.  
  140. #ifdef    STAT_MACROS_BROKEN
  141. #ifdef    S_ISREG
  142. #undef    S_ISREG
  143. #endif
  144. #ifdef    S_ISDIR
  145. #undef    S_ISDIR
  146. #endif
  147. #endif    /* STAT_MACROS_BROKEN.  */
  148.  
  149. #ifndef    S_ISREG
  150. #define    S_ISREG(mode)    (((mode) & S_IFMT) == S_IFREG)
  151. #endif
  152. #ifndef    S_ISDIR
  153. #define    S_ISDIR(mode)    (((mode) & S_IFMT) == S_IFDIR)
  154. #endif
  155.  
  156.  
  157. #if    (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
  158. #include <stdlib.h>
  159. #include <string.h>
  160. #define    ANSI_STRING
  161. #else    /* No standard headers.  */
  162.  
  163. #ifdef HAVE_STRING_H
  164. #include <string.h>
  165. #define    ANSI_STRING
  166. #else
  167. #include <strings.h>
  168. #endif
  169. #ifdef    HAVE_MEMORY_H
  170. #include <memory.h>
  171. #endif
  172.  
  173. #ifdef WIN32
  174. extern void *malloc (), *realloc ();
  175. #else
  176. extern char *malloc (), *realloc ();
  177. #endif
  178. extern void free ();
  179.  
  180. extern void abort (), exit ();
  181.  
  182. #endif    /* Standard headers.  */
  183.  
  184. #ifdef    ANSI_STRING
  185.  
  186. #ifndef    index
  187. #define    index(s, c)    strchr((s), (c))
  188. #endif
  189. #ifndef    rindex
  190. #define    rindex(s, c)    strrchr((s), (c))
  191. #endif
  192.  
  193. #ifndef    bcmp
  194. #define bcmp(s1, s2, n)    memcmp ((s1), (s2), (n))
  195. #endif
  196. #ifndef    bzero
  197. #define bzero(s, n)    memset ((s), 0, (n))
  198. #endif
  199. #ifndef    bcopy
  200. #define bcopy(s, d, n)    memcpy ((d), (s), (n))
  201. #endif
  202.  
  203. #else    /* Not ANSI_STRING.  */
  204.  
  205. #ifndef    bcmp
  206. extern int bcmp ();
  207. #endif
  208. #ifndef    bzero
  209. extern void bzero ();
  210. #endif
  211. #ifndef    bcopy
  212. extern void bcopy ();
  213. #endif
  214.  
  215. #endif    /* ANSI_STRING.  */
  216. #undef    ANSI_STRING
  217.  
  218. /* SCO Xenix has a buggy macro definition in <string.h>.  */
  219. #undef    strerror
  220.  
  221. #ifndef ANSI_STRING
  222. extern char *strerror ();
  223. #endif
  224.  
  225.  
  226. #ifdef    __GNUC__
  227. #undef    alloca
  228. #define    alloca(n)    __builtin_alloca (n)
  229. #else    /* Not GCC.  */
  230. #ifdef    HAVE_ALLOCA_H
  231. #include <alloca.h>
  232. #else    /* Not HAVE_ALLOCA_H.  */
  233. #ifndef    _AIX
  234. extern char *alloca ();
  235. #endif    /* Not AIX.  */
  236. #endif    /* HAVE_ALLOCA_H.  */
  237. #endif    /* GCC.  */
  238.  
  239. #ifndef    iAPX286
  240. #define streq(a, b) \
  241.   ((a) == (b) || \
  242.    (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
  243. #else
  244. /* Buggy compiler can't handle this.  */
  245. #define streq(a, b) (strcmp ((a), (b)) == 0)
  246. #endif
  247.  
  248. /* Add to VAR the hashing value of C, one character in a name.  */
  249. #define    HASH(var, c) \
  250.   ((var += (c)), (var = ((var) << 7) + ((var) >> 20)))
  251.  
  252. #if defined(__GNUC__) || defined(ENUM_BITFIELDS)
  253. #define    ENUM_BITFIELD(bits)    :bits
  254. #else
  255. #define    ENUM_BITFIELD(bits)
  256. #endif
  257.  
  258. #ifdef __MSDOS__
  259. #define PATH_SEPARATOR_CHAR ';'
  260. #else
  261. #define PATH_SEPARATOR_CHAR ':'
  262. #endif
  263.  
  264. extern void die ();
  265. extern void message (), fatal (), error ();
  266. extern void makefile_error (), makefile_fatal ();
  267. extern void pfatal_with_name (), perror_with_name ();
  268. extern char *savestring (), *concat ();
  269. extern char *xmalloc (), *xrealloc ();
  270. extern char *find_next_token (), *next_token (), *end_of_token ();
  271. extern void collapse_continuations (), remove_comments ();
  272. extern char *sindex (), *lindex ();
  273. extern int alpha_compare ();
  274. extern void print_spaces ();
  275. extern struct dep *copy_dep_chain ();
  276. extern char *find_char_unquote (), *find_percent ();
  277.  
  278. #ifndef    NO_ARCHIVES
  279. extern int ar_name ();
  280. extern void ar_parse_name ();
  281. extern int ar_touch ();
  282. extern time_t ar_member_date ();
  283. #endif
  284.  
  285. extern void dir_load ();
  286. extern int dir_file_exists_p (), file_exists_p (), file_impossible_p ();
  287. extern void file_impossible ();
  288. extern char *dir_name ();
  289.  
  290. extern void define_default_variables ();
  291. extern void set_default_suffixes (), install_default_suffix_rules ();
  292. extern void install_default_implicit_rules (), count_implicit_rule_limits ();
  293. extern void convert_to_pattern (), create_pattern_rule ();
  294.  
  295. extern void build_vpath_lists (), construct_vpath_list ();
  296. extern int vpath_search ();
  297.  
  298. extern void construct_include_path ();
  299. extern void uniquize_deps ();
  300.  
  301. extern int update_goal_chain ();
  302. extern void notice_finished_file ();
  303.  
  304. extern void user_access (), make_access (), child_access ();
  305.  
  306.  
  307. #ifdef    HAVE_VFORK_H
  308. #include <vfork.h>
  309. #endif
  310.  
  311. /* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
  312.    because such systems often declare the in header files anyway.  */
  313.  
  314. #if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION)
  315.  
  316. extern long int atol ();
  317. extern long int lseek ();
  318.  
  319. #endif    /* Not GNU C library or POSIX.  */
  320.  
  321. #ifdef    HAVE_GETCWD
  322. extern char *getcwd ();
  323. #else
  324. extern char *getwd ();
  325. #define    getcwd(buf, len)    getwd (buf)
  326. #endif
  327.  
  328. extern char **environ;
  329.  
  330. extern char *reading_filename;
  331. extern unsigned int *reading_lineno_ptr;
  332.  
  333. extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
  334. extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
  335. extern int env_overrides, no_builtin_rules_flag, print_version_flag;
  336. extern int print_directory_flag, warn_undefined_variables_flag;
  337. extern int posix_pedantic;
  338.  
  339. #if NeXT || NeXT_PDO
  340. extern unsigned int next_flag;
  341. #define NEXT_VPATH_FLAG            (1 << 0)
  342. #define NEXT_QUIET_FLAG            (1 << 3)
  343. #define NEXT_MAKEFILES_FLAG        (1 << 4)
  344. #define NEXT_FINDFILE_FLAG        (1 << 6)
  345. #define NEXT_CARET_FLAG            (1 << 7)
  346. #define NEXT_DEFAULT_FLAGS        (NEXT_VPATH_FLAG |     \
  347.                      NEXT_FINDFILE_FLAG |    \
  348.                      NEXT_QUIET_FLAG |     \
  349.                      NEXT_MAKEFILES_FLAG |    \
  350.                      NEXT_CARET_FLAG)
  351.  
  352. extern int general_vpath_search();
  353. extern char *allocated_vpath_expand_for_file();
  354. #endif    /* NeXT || NeXT_PDO */
  355.  
  356. extern unsigned int job_slots;
  357. extern double max_load_average;
  358.  
  359. extern char *program;
  360. extern char *starting_directory;
  361. extern unsigned int makelevel;
  362. extern char *version_string, *remote_description;
  363.  
  364. extern unsigned int commands_started;
  365.  
  366. extern int handling_fatal_signal;
  367.  
  368.  
  369. #define DEBUGPR(msg) \
  370.   do if (debug_flag) { print_spaces (depth); printf (msg, file->name); \
  371.                fflush (stdout); } while (0)
  372.